import request from '@/utils/request'

const API_NAME = '/bms/employees'

export default {
  // 获取所有员工
  queryAll() {
    return request({
      url: `${API_NAME}/`,
      method: 'get'
    })
  },
  // 分页获取所有员工
  queryByPage(page, limit, searchObj) {
    return request({
      url: `${API_NAME}/${page}/${limit}`,
      method: 'get',
      params: searchObj
    })
  },
  // 修改一个员工
  update(employee) {
    return request({
      url: `${API_NAME}/`,
      method: 'put',
      data: employee
    })
  },
  // 新增一个员工
  insert(employee) {
    return request({
      url: `${API_NAME}/`,
      method: 'post',
      data: employee
    })
  },
  // 根据ID获取一个员工
  queryById(id) {
    return request({
      url: `${API_NAME}/${id}`,
      method: 'get'
    })
  },
  // 根据工号获取一个员工(判断员工是否存在)
  queryByNo(no) {
    return request({
      url: `${API_NAME}/exist/${no}`,
      method: 'get'
    })
  }

}
